#!/bin/sh

mkdir -p <data_dir>/deploy_v3.0.3/data.pd/
mkdir -p <data_dir>/deploy_v3.0.3/log/

cd ~/TiExciting/tikv

if test -f "pid"; then
  echo "tikv-server running, kill pd..."
  kill -9 `cat pid`
  rm pid
fi

nohup ./tikv-server \
    --addr "0.0.0.0:<server_port>" \
    --advertise-addr "<server_ip>:<server_port>" \
    --status-addr "<server_ip>:<status_port>" \
    --pd "<pd_cluster>" \
    --data-dir "<data_dir>/deploy_v3.0.3/data" \
    --log-file "<data_dir>/deploy_v3.0.3/log/tikv.log" 2>> "<data_dir>/deploy_v3.0.3/log/tikv_stderr.log" & echo $! > pid
